﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MongoServices.Tests.TestHelpers
{
	[MongoCollectionName("TestModelSimple")]
	public class TestModelSimple : MongoServicesModel
	{
		[Required]
		public string TestField { get; set; }
	}

	public class TestModelSimpleEqualityComparer : IEqualityComparer<TestModelSimple>
	{
		public bool Equals(TestModelSimple x, TestModelSimple y)
		{
			return x.TestField == y.TestField;
		}

		public int GetHashCode(TestModelSimple obj)
		{
			return obj.TestField.GetHashCode();
		}
	}

	public class TestModelSimpleWithIdEqualityComparer : IEqualityComparer<TestModelSimple>
	{
		public bool Equals(TestModelSimple x, TestModelSimple y)
		{
			return x.TestField == y.TestField
					&& x.Id == y.Id;
		}

		public int GetHashCode(TestModelSimple obj)
		{
			return (obj.TestField + obj.Id).GetHashCode();
		}
	}
}
